import { observable, action } from 'mobx';

const initState = {
  loading: false,
  name: 'setting',
  settingItems: [],
};

export default class SettingStore {

  @observable loading = initState.loading;
  @observable name = initState.name;
  @observable settingItems = initState.settingItems;

  @action
  setState = (params = {}) => {
    Object.keys(params).forEach(key => {
      this[key] = params[key];
    });
    return this;
  }

  @action
  clear = () => this.setState(initState)

}
